﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:uc="clr-namespace:FileExplorer.WPF.UserControls"
    xmlns:bc="clr-namespace:FileExplorer.WPF.BaseControls"
    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Converters.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Buttons.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <ControlTemplate x:Key="HotTrackTemplate" TargetType="bc:HotTrack">
        <Border x:Name="borderCurrent" 
                                CornerRadius="{TemplateBinding CornerRadius}"
                                BorderThickness="{TemplateBinding BorderThickness}" 
                                BorderBrush="Transparent" Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" >
                        <!--<Storyboard>
                            <ObjectAnimationUsingKeyFrames 
                                            Storyboard.TargetName="borderCurrent"
                                            Storyboard.TargetProperty="BorderBrush" Duration="0:0:0.1">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" 
                                Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type bc:HotTrack},
                                    Mode=FindAncestor}, Path=SelectedBorderBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>-->
                    </VisualState>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <!--<ColorAnimation  
                                Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" 
                                Storyboard.TargetName="borderCurrent" Duration="0" To="Black" />-->

                            <DoubleAnimation Storyboard.TargetName="background"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.15" />
                            <DoubleAnimation Storyboard.TargetName="highlight"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.5" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="MouseOverGrayed">
                        <Storyboard>
                            <!--<ColorAnimation  
                                Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" 
                                Storyboard.TargetName="borderCurrent" Duration="0" To="Black" />-->

                            <DoubleAnimation Storyboard.TargetName="background"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.015" />
                            <DoubleAnimation Storyboard.TargetName="highlight"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.05" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Dragging">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="background"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.05" />
                            <DoubleAnimation Storyboard.TargetName="highlight"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.35" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="DraggingOver">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="background"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.05" />
                            <DoubleAnimation Storyboard.TargetName="highlight"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.35" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Selected">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="selected"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.35" />
                            <DoubleAnimation Storyboard.TargetName="highlight"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.5" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <!--<VisualStateGroup x:Name="FocusedStates">
                    <VisualState x:Name="Focused">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="hotTrackGrid"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="1" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Unfocused" >
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="hotTrackGrid"  Duration="0:0:0.1"
                                             Storyboard.TargetProperty="Opacity"  To="0.5" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="PointerFocused" />
                </VisualStateGroup>-->

            </VisualStateManager.VisualStateGroups>

            <Grid>
                <Grid x:Name="hotTrackGrid">
                    <Grid.RowDefinitions>
                        <RowDefinition MaxHeight="15"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <Rectangle Opacity="0" x:Name="selected"  Fill="{TemplateBinding SelectedBrush}" 
                                           Grid.RowSpan="2" />
                    <Rectangle x:Name="background" Opacity="0" Fill="{TemplateBinding BackgroundBrush}" 
                                           Grid.RowSpan="2" />
                    <Rectangle x:Name="highlight"  Opacity="0" Fill="{TemplateBinding HighlightBrush}"  />
                </Grid>
                <Rectangle 
                    Visibility="{Binding FillFullRow, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource btvc}}">
                    <Rectangle.Fill>
                        <VisualBrush Stretch="Uniform" Visual="{Binding ElementName=hotTrackGrid}"  />
                    </Rectangle.Fill>
                    <Rectangle.RenderTransform>
                        <ScaleTransform ScaleX="-1" />
                    </Rectangle.RenderTransform>
                </Rectangle>
                <Border Padding="{TemplateBinding Padding}" Grid.RowSpan="2">
                    <ContentPresenter x:Name="content" Content="{TemplateBinding Content}"  />
                </Border>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter TargetName="borderCurrent" Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type bc:HotTrack},
                                    Mode=FindAncestor}, Path=SelectedBorderBrush}" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="borderCurrent" Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type bc:HotTrack},
                                    Mode=FindAncestor}, Path=SelectedBorderBrush}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type bc:HotTrack}">
        <Setter Property="SelectedBrush" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" />
        <Setter Property="BackgroundBrush" Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}" />
        <Setter Property="HighlightBrush" Value="#75FFFFFF" />
        <Setter Property="Template" Value="{StaticResource HotTrackTemplate}" />
    </Style>


</ResourceDictionary>